package com.livestocksolutions.ui;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.livestocksolutions.R;
import com.livestocksolutions.intent.BaseActivity;

/* -- Version History --
 *  1.0 : 10 September 2012 - Initial version.
 */

/**
 * A base class to create the layout for a List of Joins
 * @author Adam Parr
 * @version 1.0
 * 
 * @.modified 19 October 2012
 */
public class ListJoinArrayAdapter extends ViewJoinArrayAdapter {
	/**
	 * Constructor
	 * @param context The current context.
	 * @param values The Joining data to represent in the ListView.
	 */
	public ListJoinArrayAdapter(BaseActivity context, String[][] values) {
		super(context, values);
	}
	

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		setView(R.layout.list_item_join);
		final View rowView = super.setView(position, convertView, parent);
		TextView joinEntry = (TextView) rowView.findViewById(R.id.joinEntry);
		TextView joinExit = (TextView) rowView.findViewById(R.id.joinExit);
		TextView joinCount = (TextView) rowView.findViewById(R.id.joinCount);
		joinEntry.setText(context.format(context.parse(values[position][INSERTIONDATE])));
		joinExit.setText(context.format(context.parse(values[position][REMOVALDATE])));
		joinCount.setText(values[position][COUNT]);
		return rowView;
	}
}
